The present invention relates to a data processing apparatus which can perform, at high speed, the processing of data arranged in two dimensions, such as figure-producing processing and image processing. The invention also relates to a shading apparatus for adding realistic shading, such as spot light or high light shading, to figure data, etc. handled in the data processing apparatus.
A point has been reached for processing data at high speed with two-dimensional extension in the address management of data. A method of managing addresses relative to data with two-dimensional extension is disclosed in xe2x80x9cGary Newmann, Memory Management Support for Tiled Array Organization, Computer Architecture News, Vol. 20, No. 4, September 1992, PP.22-29xe2x80x9d, which relates to image management. Further, the same method is described in U.S. Pat. No. 5,247,632. In the disclosed method, the data with two-dimensional extension (referred to hereinafter as two-dimensionally arranged data) is referenced not only in a row direction, but also in a column direction. The data includes imaginary values in logic.
Generally, with reference to two-dimensionally arranged data, data which exists in the peripheral portion of one data value is also referred to at the same time. For example, when one data value is referred to, data in the neighborhood of the two-dimensional arrangement of the one data value is also referred to within a predetermined time.
Logical addresses include an array type address and a tile type address. The former is an address arranged in such a way that the physical address of row data in two-dimensional arrangement may continue. The latter is an address arranged in such a way that data in a square region, including the data in the neighborhood of a two-dimensional arrangement, may continue physically.
In the prior method, after an array type address generated in an access-source is first converted into a tile type address corresponding to the physical arrangement, a physical address is generated by normal address translation from a logical address to a physical address. The rule for the conversion is determined only by the physical arrangement of the data. Because the rule for address translation or the conversion rule is determined only by the physical arrangement in the prior method, there is a problem in that tile type data can not be referred to as array type data. This is because the array type reference is converted to a tile type reference in the course of the conversion. Further, there are some problems in that, because a two-step address translation is necessary, it takes much time to convert the address, so that the address translation is not performed at high speed, and the management is complicated because it is different at each step of the address translation.
Those problems become remarkable in a graphic processing system, such as a portable data processing apparatus (PDA), a personal computer, and a future type work station (WS), in which a main memory for storing general data and programs and an image memory for storing picture data for drawing and display (ex. a frame buffer) are combined with each other and thus are managed on a single memory device. Namely, this is a case wherein an access from a process or a plurality of hardware, such as access to draw, DMA transfer and direct access from software, arises.
Particularly in the case of direct access from software, in order to not affect the software interface of the prior system, namely to maintain compatibility, access processing and address translation processing must be performed. If this is not done, then it is necessary to convert the tile type arranged data into array type data by using dedicated hardware or software, and thus it takes more time and twice as many data regions are required.
In the above-mentioned WS, PC, PDA, and so on, an improved data processing apparatus which uses a portable processor for access is desired, in which a CPU and a picture processing unit for processing picture data to draw are installed as one processing unit, and a main memory and a frame buffer are combined as one memory. In such a system, in order to decrease the amount of memory, it is necessary to share the picture data region between the CPU and the picture processing unit. Further, it is necessary for the CPU to refer to the picture data as it is without making a copy. In particular, it is required to effect access in such a way as to not lose the compatibility of software, even if the data arrangement is changed.
As to a shading apparatus, Phong shading, the technique for expressing light in such a way that its direction and its strength are varied according to the expression of a curved surface or the position, is well-known, as described in, for example, xe2x80x9cComputer Graphics : Principle and Practicexe2x80x9d. In Phong shading, the surface of a three-dimensional figure expressed by the combination of flat surfaces is smoothly shaded. The normal vector at a point on the flat surface corresponding to a display pixel is interpolated and obtained by using the value of a normal vector at each vertex defined in the step of modeling the three-dimensional figure. Secondly, on the basis of the obtained normal vector, the amount of light impinging at the point is calculated and shaded.
With regard to the normal-interpolation method, there is a known angle-interpolation method which uses a rotation matrix as described in Japanese Patent Laid-Open No. 2-202681 (1990), other than the above-mentioned method in which the normalization is performed after respective components of the vector are interpolated. This prior method states that the angle-interpolation should tee carried out by using the rotation matrix, in order to eliminate the normalization processing of a geometrical vector after interpolation.
However, the prior method as described in the above-mentioned manual aims principally at a method of obtaining a normal vector defined only by the modeling, by using interpolation. It is not, therefore, believed to simplify the calculation of luminance at a point on the flat surface. Accordingly, it is required to re-calculate more accurately the light beam essential to calculate the luminance each time.
Because in general the linearity of the vector of the light beam is not maintained on a flat surface, except in a special case, for example, in the use of a parallel light beam, the expected light vector can not be obtained by simple interpolation. Further, it is complicated to interpolate the normal. In the method described in the above-mentioned manual, it becomes necessary to perform the normalization process after the interpolation.
It is necessary to obtain a rotation matrix and its varying portion from the value of the geometrical vector at both sides of each span, and thus the processing becomes complicated. Further, the calculation of interpolation parameters must be frequently carried out. Furthermore, because the rotation vector must be produced based on a predetermined normal vector, there is no effect if the normal vector is not constant in the figure, namely, if a curved surface is expressed by one figure.
Also in the prior method described in the above-mentioned patent application, it is necessary to obtain the rotation matrix and its varying portion from the value of the geometrical vector at both sides of each span. Further, because the rotation vector must be produced based on a predetermined normal vector, there is no effect if the normal vector is not constant in the figure, namely, if a curved surface is expressed by one figure. Accordingly, the processing of both prior methods is complicated, and the calculation of interpolation parameters must be frequently carried out.
An object of the present invention is to provide a data processing apparatus which can access, at high speed, a memory in which various kinds of data with different addresses are mixed and stored.
Another object of the present invention is to provide a shading apparatus for the above-mentioned data processing apparatus, which can express accurately and at high speed spot lights and high lights even if the amount of hardware and the number of figures are small.
The configuration of the data processing apparatus is typically as follows.
(1) A processing apparatus for processing data by accessing a memory having first data stored with a tile-type address and second data stored with an array-type address, wherein said processing apparatus accesses said memory with addressing using a tile-type address or an array-type address in response to a first process for processing said first data and a second process for processing said second data.
(2) A processing apparatus comprising a memory having first data stored with a tile-type address and second data stored with an array-type address; and a processing part for processing data by accessing said memory, wherein said processing part accesses said memory with addressing using a tile-type address or an array-type address in response to a first process for processing said first data and a second process for processing said second data.
The configuration of the shading apparatus is typically as follows.
(1) A shading method performed in an image display apparatus having at least one image display unit; at least one image data storing unit for storing an image displayed on said image display unit; and at least one graphic generator for generating a graphic pattern defining said image data, said shading method calculating parameters, each defining luminance at an individual pixel forming said graphic pattern, said parameters defined for an individual graphic pattern and at an individual vertex at said graphic pattern, wherein plural geometrical vectors are defined as said parameters at said individual vertex; said plural geometrical vectors are interpolated in a graphic pattern; and luminance is calculated for a small region in a graphic pattern by using plural geometrical vectors generated by interpolation.
(2) A shading apparatus included in an image display apparatus having at least one image display unit; at least one image data storing unit for storing an image displayed on said image display unit; and at least one graphic generator for generating a graphic pattern defining said image data, said shading apparatus calculating parameters, each defining luminance at an individual pixel forming said graphic pattern, said parameters defined for an individual graphic pattern and at an individual vertex at said graphic pattern, comprising: a defining means for defining plural geometrical vectors as said parameters at said individual vertex; an interpolation means for interpolating said plural geometrical vectors in a graphic pattern; and a calculation means for calculating luminance for a small region in a graphic pattern by using plural geometrical vectors generated by interpolation, said shading apparatus calculating luminance for a small region.